package com.childmiles.gwt.client.ui.login;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.dom.client.HasKeyDownHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;

public class LoginView extends Composite implements LoginPresenter.Display {
    interface LoginViewUiBinder extends UiBinder<Widget, LoginView> {
    }
    private static LoginViewUiBinder uiBinder = GWT.create(LoginViewUiBinder.class);

    @UiField
    Button okButton;
    @UiField
    TextBox awardWinnerNameTextBox;

    public LoginView() {
        initWidget(uiBinder.createAndBindUi(this));
        
        //Set focus
        DeferredCommand.addCommand(new Command() {
            public void execute() {
                awardWinnerNameTextBox.setFocus(true);
            }
        });
    }

    public Widget asWidget() {
        return this;
    }

    public HasText getAwardWinnerNameTextBox() {
        return awardWinnerNameTextBox;
    }

    public HasKeyDownHandlers getAwardWinnerNameTextBoxForKeyDownHandler() {
        // TODO Auto-generated method stub
        return awardWinnerNameTextBox;
    }

    public HasClickHandlers getOkButton() {
        return okButton;
    }
}
